<template>
  <div>
    <sea-icon-uploader v-model="img"></sea-icon-uploader>
  </div>
</template>

<script>

let options = [
    {value: 1, label: '区域1'}
    , {value: 2, label: '区域2'}
];


let tree1 = [
    {id: 1, label: '一级 1'}
    , {id: 4, pid: 1, label: '二级 1-1'}
    , {id: 9, pid: 4, label: '三级 1-1-1'}
    , {id: 2, pid: 4, label: '一级 2'}
];

let tree2 = [
    {id: 1, label: '一级 1'}
    , {id: 4, pid: 1, label: '二级 1-1'}
    , {id: 9, pid: 4, label: '三级 1-1-1'}
    , {id: 2, pid: 4, label: '一级 2'}
];

export default {
    components: {},
    data() {
        return {
            img: '',
            treeId: [1,2],
            options: options,
            tree1: tree1,
            tree2: tree2,
            model: [
                {name: 'text', label: '文本'}
                , {name: 'hidden', label: '隐藏组件'}
                , {name: 'number', label: '数字'}
                , {name: 'textarea', label: '文本域'}
                , {name: 'switch', label: '开关'}
                , {name: 'checkbox', label: '开关'}
                , {name: 'select', label: '选择'}
                , {name: 'radio_group', label: '单选'}
                , {name: 'checkbox_group', label: '复选'}

                , {name: 'date', label: '日期'}
                , {name: 'data_range', label: '日期'}
            ]
        }
    },

    mounted() {
        this.$nextTick(() => {
            console.log('-------------------------------------------------------------')
            // console.log(this.$refs.form.serialize());
            console.log('-------------------------------------------------------------')
        })
    },
    methods: {
        /**
         * 数据联动触发器
         *
         * @param name  字段名
         * @param value 值
         * @param formGroup {FastForm}
         */
        trigger: function (name, value, formGroup) {
            console.log(name + ' - ' + value);
            // let editor = this.$layers.fetch(formGroup, e => e.name === 'editor');
            // console.log('==============================================================')
            // console.log(editor.getValue());
            // console.log('==============================================================')
        },
        onSubmit: function (data) {
            console.log(data);
            return false;
        },
        onReset: function () {
            this.$refs.form.reset();
        }
    }
}
</script>
